import java.util.*;


public class minNum {
    /**
     * return the min number
     * @param arr int整型一维数组 the array
     * @return int整型
     */
    public int minNumberdisappered (int[] arr) {      //求数组中没有出现的最小正整数;
        int s=0;
        ArrayList<Integer> objects = new ArrayList<>();
        for (int i=0;i<arr.length;i++){
            objects.add(arr[i]);
        }
        objects.sort(Comparator.naturalOrder());

        for (int j=0;j<objects.size()-1;j++){
            if (objects.get(j+1)-objects.get(j)>1){
                if (objects.get(j)<0&&objects.get(j+1)>0)
                {  s=objects.get(j+1)-1;
                }else {
                    s=objects.get(j)+1;
                }
                if(s!=0){
                    break;
                }
            }else{
                s=objects.get(objects.size()-1)+1;
            }

        }
        return s;
    }
}